Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full support for OpenTelemetry tracing, use it instead of XRay in runDB #120

Merged
merged 18 commits into from
Sep 25, 2023

Conversation

pbrisbin
Copy link
Member

@pbrisbin pbrisbin commented Sep 22, 2023

This was spiked, implemented, used in platform-example-app, then shelved
because megarepo wasn't ready for it. I got nervous having the code live in
a branch and devised a way to land it in main so we could use it from Platform
Apps, but still be able to keep megarepo on XRay.

The CHANGELOG sums up well where we landed:

This replaces our bespoke, XRay-based MonadTracer class to be that of
hs-opentelemetry. This means Freckle.App.Database.runDB now traces using
OpenTelemetry instead of XRay. A compilation error will indicate a missing
HasTracer instance, which you should implement based on the
Freckle.App.OpenTelemetry module documentation.

Clients who wish to remain on XRay can still upgrade, but must adjust their
imports so they use Freckle.App.Database.XRay instead. The
Freckle.App.Database module is re-exported through Freckle.App and
Freckle.App.Test, so there may be some additional hiding required. A
compilation error indicating a missing HasTracer or MonadTracer instance
means your imports are not yet correct.


I've already tested using this from megarepo (staying on XRay) and progress
(opting in for tracing), so I'm relatively confident the .XRay module plan works.


@pbrisbin pbrisbin changed the title pb/otel Full support for OpenTelemetry tracing, use it instead of XRay in runDB Sep 22, 2023
@pbrisbin pbrisbin marked this pull request as ready for review September 22, 2023 19:00
@pbrisbin
Copy link
Member Author

The Freckle.App.Database module is re-exported through Freckle.App and Freckle.App.Test, so there may be some additional hiding required

This is actually a smell, IMO, that I have to deal with this in our own clients, so I'm going to remove the re-exports and see if things work out better.

It should mean adding import Freckle.App.Database.XRay now, but then being able to uniformly s/.XRay// later to move onto OTel, which is better than having to remove and/or undo hiding. 🤞

This makes it harder for clients to decide between the default OTel
tracing vs XRay-based. It was always a bit too opinionated anyway.
Having to bring in the Database module only if/when you need it is kind
of nice anyway.
Copy link
Contributor

@chris-martin chris-martin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like I'm missing enough xray/otel knowledge to give substantive feedback here, but I think it all makes enough sense.

@pbrisbin pbrisbin enabled auto-merge (rebase) September 25, 2023 13:24
@pbrisbin
Copy link
Member Author

OK, I tossed in a bunch of packaging fixes.

@pbrisbin pbrisbin merged commit bb4a210 into main Sep 25, 2023
7 checks passed
@pbrisbin pbrisbin deleted the pb/otel branch September 25, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants